DataKind
library(tidyverse)
library(ggplot2)
library(forecast)
library(astsa)
library(xts)
library(tseries)
library(fpp2)
library(fma)
library(lubridate)
library(TSstudio)
library(quantmod)
library(tidyquant)
library(plotly)
library(ggplot2)
datas<-read.csv("som_food.csv",header = TRUE)
#str(datas)
datas$date<-as.Date(datas$date,"%Y-%m-%d")
#head(datas)
datas<-data.frame(datas)
datas$usdprice<-as.numeric(datas$usdprice)
datas$commodity<-as.factor(datas$commodity)
datas$admin1<-as.factor(datas$admin1)
datas<-datas[-1,]
#str(datas)
fig1 <- plot_ly(datas, x = ~date, y = ~usdprice, text = ~admin1, type = 'scatter', mode = 'lines+markers',
color = ~admin1,size = ~usdprice,
marker = list(opacity = 0.5))
fig1 <- fig1 %>% layout(title = 'Price by Region',
xaxis = list(showgrid = FALSE),
yaxis = list(showgrid = FALSE))
fig1
df4<-datas[!datas$admin1=="Mudug",]
fig11 <- plot_ly(df4, x = ~date, y = ~usdprice, text = ~admin1, type = 'scatter', mode = 'lines+markers',
color = ~admin1,size = ~usdprice,
marker = list(opacity = 0.5))
fig11 <- fig11 %>% layout(title = 'Price by Region without Camel Meat',
xaxis = list(showgrid = FALSE),
yaxis = list(showgrid = FALSE))
fig11
fig2 <- plot_ly(datas, x = ~date, y = ~usdprice, text = ~commodity, type = 'scatter', mode = 'lines+markers',
color = ~commodity,size = ~usdprice,
marker = list(opacity = 0.5))
fig2 <- fig2 %>% layout(title = 'Price by Commodity',
xaxis = list(showgrid = FALSE),
yaxis = list(showgrid = FALSE))
fig2
df2<-datas[!datas$commodity=="Meat (camel)",]
fig3 <- plot_ly(df2, x = ~date, y = ~usdprice, text = ~commodity, type = 'scatter', mode = 'lines+markers',
color = ~commodity,size = ~usdprice,
marker = list(opacity = 0.5))
fig3 <- fig3 %>% layout(title = 'Price by Commodity without Camel Meat',
xaxis = list(showgrid = FALSE),
yaxis = list(showgrid = FALSE))
fig3
df3<-df2[!df2$commodity=="Livestock (Goat)",]
fig4 <- plot_ly(df3, x = ~date, y = ~usdprice, text = ~commodity, type = 'scatter', mode = 'lines+markers',
color = ~commodity,size = ~usdprice,
marker = list(opacity = 0.5))
fig4 <- fig4 %>% layout(title = 'Price by Commodity without Camel Meat and Livestock(goat)',
xaxis = list(showgrid = FALSE),
yaxis = list(showgrid = FALSE))
fig4